// app.js
import {baseUrl} from "./utils/config";
App({
  onLaunch() {
  },
  request(url,data = {},methods = "get") {
    wx.showLoading();
    return new Promise((resolve,reject)=>{
      wx.request({
        url: baseUrl + url,
        methods,
        data,
        header: {
          'content-type': 'application/json' // 默认值
        },
        success (res) {
          if(res.data.code == 666){
            resolve(res.data);
          // console.log(res.data)
        }else {
          reject(res.data);
          // console.log('失败');
        }
        },
        fail (error) {
          reject(error);
          // console.log(error);
        },
        
      })
    });
  }
})
